﻿using Sustainalytics.ScreeningTool.Synchronization.Processors;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Sustainalytics.ScreeningTool.Synchronization.Logging
{
    public class ProcessorLoggingDecorator : IProcessor
    {
        private readonly IProcessor _processor;

        public ProcessorLoggingDecorator(IProcessor processor)
        {
            _processor = processor;
        }

        public string CollectionName => _processor.CollectionName;

        public async Task ForEachExtraElementsAsync(Func<IEnumerable<ExtraElement>, Guid, Task> processExtraElements)
        {
            await Log.Execution(
                $"processing collection {CollectionName}",
                () => _processor.ForEachExtraElementsAsync(processExtraElements));
        }
    }
}
